<?php
/*
 * 
 * 获取地址中的URI参数
 * 
 */
CLASS URI{
	var $uri_string;				//uri参数字符串
	
	var $segments		= array();	//uri参数数组
	function __construct()
	{

	}
	function _get_uri(){
		$uri = $_SERVER['REQUEST_URI'];
		if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
		{
			$uri = substr($uri, strlen($_SERVER['SCRIPT_NAME']));
		}
		elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
		{
			$uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
		}
		// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
		// URI is found, and also fixes the QUERY_STRING server var and $_GET array.
		if (strncmp($uri, '?/', 2) === 0)
		{
			$uri = substr($uri, 2);
		}		
		$uri=trim($uri,'/');
		if($uri==''){
			$uri="main/index";
		}elseif(stripos($uri, '/')==FALSE){
			$uri.="/index";
		}
		$this->segments=explode("/",$uri);
	}

	
	
}